<div>
    <%
       scope[:material_revisions] = scope[:pipeline_instance].getCurrentRevisions()
       scope[:show_files] = false
       scope[:pipeline_name] = scope[:pipeline_instance].getName()
    %>
    
    <table class="build_cause list_table">
        <tr>
            <th></th>
            <th></th>
            <th></th>
        </tr>
        <% scope[:material_revisions].getRevisions().each do |material_revision_in_build_cause|
            scope[:material] = material_revision_in_build_cause.getMaterial()
            material_id = "material_#{pipeline_instance_identifier(scope[:pipeline_instance])}_#{scope[:material].getDisplayName()}"
           changed_css = material_revision_in_build_cause.isChanged() ? ' changed' : ""
        %>
            <tr id="<%= material_id %>">
                <td colspan="3" id="material_<%= material_revision_in_build_cause.getMaterial().getPipelineUniqueFingerprint() -%>" class="material<%= changed_css -%>">
                   <strong> <%= "#{scope[:material].getTypeForDisplay()}" %> - <span class="wrapped_word"><%= scope[:material].getDisplayName() -%></span> </strong>
                </td>
            </tr>
            <% if !dependency_material?(scope[:material]) %>
                <% material_revision_in_build_cause.getModifications().each_with_index do |mod_in_build_cause,i| %>
                    <%= render :partial => "shared/modification_for_table.html", :locals => {:scope => {:modification => mod_in_build_cause, :pipeline_name => scope[:pipeline_name],
                                                                                                        :show_files => scope[:show_files], :id => "#{material_id}_#{i}",
                                                                                                        :changed_css=>changed_css, :material => material_revision_in_build_cause.getMaterial()}} -%>
                <% end %>
            <% else %>
                <tr class="change <%=changed_css-%>" id="<%=material_id%>_0">
                    <% scope[:dmr] = material_revision_in_build_cause.getRevision() %>
                    <td class="revision">
                        <%= link_to(scope[:dmr].getRevision(), path_for_stage(scope[:dmr])) -%>
                    </td>
                    <td class="label">
                        <%= link_to(scope[:dmr].getPipelineLabel(), url_for_dmr(scope[:dmr])) -%>
                    </td>
                    <td class="completed_at">
                        <%= material_revision_in_build_cause.getLatestModification().getModifiedTime().iso8601 -%>
                    </td>
                </tr>
            <% end %>
        <% end %>
    </table>
</div>
